//  不要给我WA WA 叫
//  一定AC
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cmath>
#include <iomanip>
#include <climits>
#define int long long
#define PI acos(-1) 
using namespace std;
const int N = 1e5 + 10;
int a[N];
void solve()
{
    int n,k;
    cin >> n >> k;
    double res[N];
    for(int i = 1; i <= n; i++)
    {
        int x,y,r;
        cin >> x >> y >> r;
        double s = r * r * PI;
        res[i] = ((double)(s * (r - sqrt(x * x + y * y))));
    }
     for(int i = 1; i <= n;i++) 
    {
        if(res[i] < 0) res[i] = 0;
    }
    sort(res + 1,res + n + 1);
    double ans = 0.0;
    for(int i = 1; i <= n - k; i++) 
    {
        ans += res[i];
    }
    cout << fixed << setprecision(10) << ans << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t = 1;
    while(t -- )  solve();
    return 0;
}